package com.oim.fx.ui.component;

import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

/**
 * @author: XiaHui
 * @date: 2017年4月11日 上午10:14:29
 */
public class PagePanel extends HBox {

	int pageNumber;
	int totalPage;

	HBox textBox = new HBox();
	HBox buttonBox = new HBox();

	public PagePanel() {
		initComponent();
		initEvent();
	}

	private void initComponent() {
		this.setSpacing(3);
		this.setAlignment(Pos.CENTER_RIGHT);

		VBox tempBox = new VBox();
		tempBox.getChildren().add(textBox);

		this.getChildren().add(this.getGapNode(5));
		this.getChildren().add(tempBox);
		this.getChildren().add(buttonBox);
		this.getChildren().add(this.getGapNode(2));

	}

	private void initEvent() {
		// TODO Auto-generated method stub

	}

	public void setPage(int pageNumber, int totalPage) {
		this.pageNumber = pageNumber;
		this.totalPage = totalPage;
	}

	public Node getGapNode(double value) {
		AnchorPane pane = new AnchorPane();
		pane.setPrefWidth(value);
		pane.setPrefHeight(value);
		pane.setBackground(Background.EMPTY);
		return pane;
	}
}
